<template>
  <div>
    <van-nav-bar title="商品列表" @click-right="rightClick" right-text="爬楼费设置" />
    <van-tabs v-model="active" title-active-color="#26A2FF" color="#26A2FF" swipeable>
      <van-tab title="全部">
        <product-list ref="list1" @afterDel="afterDel"></product-list>
      </van-tab>
      <van-tab title="本厂">
        <product-list ref="list2" @afterDel="afterDel" :own="2"></product-list>
      </van-tab>
      <van-tab title="自营">
        <product-list ref="list3" @afterDel="afterDel" :own="1"></product-list>
      </van-tab>
      <van-tab title="其他水厂">
        <product-list ref="list4" @afterDel="afterDel" :own="0"></product-list>
      </van-tab>
    </van-tabs>
  </div>
</template>

<script>
import ProductList from '@/components/ProductList'
  export default {
    components: {
      ProductList
    },
    data() {
      return {
        active: 0
      }
    },
    methods: {
      leftClick() {
        this.$router.go(-1)
      },
      rightClick(){
        this.$router.push({
          name: 'palouAdd'
        })
      },
      //删除后刷新其他列表
      afterDel(){
        this.$refs['list1'].onRefresh();
        this.$refs['list2'].onRefresh();
        this.$refs['list3'].onRefresh();
        this.$refs['list4'].onRefresh();
      }
    }
  }

</script>

<style lang="less" scoped>
  
</style>
